package com.gitee.wsl.flowing.pipeline

/**
 * Server response send pipeline.
 */
open class ApplicationSendPipeline<T:Any>(
    override val developmentMode: Boolean = false
) : Pipeline<Any, T>(Before, Transform, Render, ContentEncoding, TransferEncoding, After, Engine) {
    /**
     * Send pipeline phases.
     */
    @Suppress("PublicApiImplicitType")
     companion object Phases {
        /**
         * The earliest phase that happens before any other
         */
         val Before: PipelinePhase = PipelinePhase("Before")

        /**
         * A transformation phase that can proceed with any supported data like String.
         */
         val Transform: PipelinePhase = PipelinePhase("Transform")

        /**
         * A phase to render any current pipeline subject into [io.ktor.http.content.OutgoingContent].
         *
         * Beyond this phase, only [io.ktor.http.content.OutgoingContent] should be produced by any interceptor.
         */
         val Render: PipelinePhase = PipelinePhase("Render")

        /**
         * A phase for processing `Content-Encoding`, like compression and partial content.
         */
         val ContentEncoding: PipelinePhase = PipelinePhase("ContentEncoding")

        /**
         * A phase for handling `Transfer-Encoding`, like if chunked encoding is being done manually and not by engine.
         */
         val TransferEncoding: PipelinePhase = PipelinePhase("TransferEncoding")

        /**
         * The latest application phase that happens right before an engine sends a response.
         */
         val After: PipelinePhase = PipelinePhase("After")

        /**
         * A phase for Engine to send the response out to the client.
         */
         val Engine: PipelinePhase = PipelinePhase("Engine")
    }
}